var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
// 类 : 方法
var CommonUtil = /** @class */ (function () {
    function CommonUtil() {
    }
    // 获取随机数
    CommonUtil.prototype.getRandom = function (min, max) {
        return Math.floor(Math.random() * (max - min) + min);
    };
    return CommonUtil;
}());
var HandleCode = /** @class */ (function (_super) {
    __extends(HandleCode, _super);
    function HandleCode() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    HandleCode.prototype.handleClick = function (code) {
        var oDiv = document.createElement("div");
        oDiv.style.position = 'absolute';
        switch (code) {
            case 200 /* Code.success */:
                // 处理成功的逻辑
                oDiv.style.width = this.getRandom(50, 200) + 'px';
                oDiv.style.height = this.getRandom(50, 200) + 'px';
                oDiv.style.left = this.getRandom(0, 1200) + 'px';
                oDiv.style.top = this.getRandom(0, 500) + 'px';
                oDiv.style.backgroundColor = "#00ff00";
                oDiv.innerHTML = code + "";
                break;
            case 401 /* Code.unToken */:
                // 处理成功的逻辑
                break;
            case 400 /* Code.badRequest */:
                // 处理成功的逻辑
                break;
            case 403 /* Code.unAuthor */:
                // 处理成功的逻辑
                break;
            case 500 /* Code.serverError */:
                // 处理成功的逻辑
                break;
        }
        document.body.appendChild(oDiv);
    };
    return HandleCode;
}(CommonUtil));
var handle = new HandleCode();
